<template>
<ElConfigProvider :locale='locale'>
  <router-view></router-view>
  </ElConfigProvider>
</template>

<script>
import { ElConfigProvider} from 'element-plus'
import zhLocale from 'element-plus/lib/locale/lang/zh-cn'
import { defineComponent, watch, getCurrentInstance ,ref} from 'vue'
import { useStore } from 'vuex'

export default defineComponent({
  components:{
    [ElConfigProvider.name]:ElConfigProvider
  },
  setup() {
    const store = useStore()
    const {proxy} = getCurrentInstance()

    watch(()=>proxy.$route, (to)=>{
      store.commit('setNavTabs', {name: to.meta.title, path: to.path})
      store.commit('setActivePath', to.path)

      let path = to.path.split('/')
      path.shift()
      store.commit('setTabId', path[0])
      store.commit('setNavBreadcrumbs', path)
    })

  const locale=ref(zhLocale)
  return{
    locale
  }
  }
})
</script>


<style lang="scss">

</style>
